import request from '@/utils/request'

/**
 * 订单列表
 * http://192.168.88.247:4999/web/#/80/557
 * @param {*} data
 * @returns
 */
export function listOrder (data) {
  return request({
    url: '/v1/order/list',
    // method: 'get',
    // params: query
    method: 'post',
    data
  })
}

/**
 * 订单详情
 * http://192.168.88.247:4999/web/#/80/558
 * @param {*} id
 * @returns
 */
export function getOrder (id) {
  return request({
    url: '/v1/order/detail/' + id,
    method: 'get'
  })
}
/**
 * 订单详情
 * http://192.168.88.247:4999/web/#/80/1797
 * @param {*} data
 * @returns
 */
export function refundOrder (data, codeObj) {
  return request({
    url: `/v1/order/refund?vcode=${codeObj.code}&vid=${codeObj.vid}`,
    method: 'post',
    data
  })
}
/**
 * 获取关联的买二赠一订单
 * http://192.168.88.247:4999/web/#/80?page_id=2893
 * @param {*}
 * @returns
 */
export function getGiveOrder (params) {
  return request({
    url: '/v1/order/relation_give_order',
    method: 'get',
    params
  })
}

/**
 * 创建导出订单任务
 * http://showdoc.wisetimes.cn:4999/web/#/80?page_id=3046
 * @param {*} data
 * @returns
 */
export function createExportOrderTask (data) {
  return request({
    url: '/v1/order/export',
    method: 'post',
    data
  })
}

/**
 * 查询导出订单任务结果
 * http://showdoc.wisetimes.cn:4999/web/#/80/3047
 * @param {*} params
 * @returns
 */
export function queryExportOrderTask (params) {
  return request({
    url: '/v1/order/export_task',
    method: 'get',
    params
  })
}
